﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Drawing;

namespace CS633_Final_Project
{
    /// <summary>
    /// Represents a robot in the environment.
    /// </summary>
    class Robot
    {
        /// <summary>
        /// The available types of roles for a robot.
        /// </summary>
        public enum Type { PURSUER, EVADER };
        private Type role;
        private int id;
        private PointF location;
        private Triangle locationTriangle;
        private bool caught;
        private bool stuck;
        private int stuckTurnCount;

        /// <summary>
        /// String representation of the robot.
        /// </summary>
        /// <returns>String representation of the robot.</returns>
        public override string ToString()
        {
            return role.ToString() + id + " [" + location.ToString() + "]";
        }

        /// <summary>
        /// Returns whether or not two robots are equal.
        /// </summary>
        /// <param name="obj">Another Robot.</param>
        /// <returns>Whether or not the robots are equal</returns>
        public override bool Equals(object obj)
        {
            Robot anotherRobot = (Robot)obj;
            return this.Id.Equals(anotherRobot.Id);
        }

        /// <summary>
        /// Gets the hashcode of the robot.
        /// </summary>
        /// <returns>Hashcode.</returns>
        public override int GetHashCode()
        {
            return this.id.GetHashCode();
        }

        /// <summary>
        /// The role of the robot.
        /// </summary>
        public Type Role
        {
            get { return this.role; }
            set { this.role = value; }
        }

        /// <summary>
        /// The Id of the robot.
        /// </summary>
        public int Id
        {
            get { return this.id; }
            set { this.id = value; }
        }

        /// <summary>
        /// The location of the robot.
        /// </summary>
        public PointF Location
        {
            get { return this.location; }
            set { this.location = value; }
        }

        /// <summary>
        /// Location Triangle of a pursuer.
        /// </summary>
        public Triangle LocationTriangle
        {
            get { return this.locationTriangle; }
            set { this.locationTriangle = value; this.location = this.locationTriangle.Center; }
        }

        /// <summary>
        /// Returns whether or not the evader is caught or not.
        /// </summary>
        public bool Caught
        {
            get { return this.caught; }
            set { this.caught = value; }
        }

        /// <summary>
        /// Returns whether the robot is stuck or not.
        /// </summary>
        public bool Stuck
        {
            get { return this.stuck; }
            set { this.stuck = value; }
        }

        /// <summary>
        /// Number of turns that the robot has been stuck.
        /// </summary>
        public int StuckTurnCount
        {
            get { return this.stuckTurnCount; }
            set { this.stuckTurnCount = value; }
        }
    }
}
